<template>
  <div class="myinput">
    <input
      type="text"
      placeholder="待办事项"
      v-model="value"
      @keydown.enter="add"
    />
    <button :style="{ background: $store.state.backcolor }">提交</button>
  </div>
</template>

<script>
export default {
  name: "myinput",
  data() {
    return {
      value: "",
    };
  },
  methods: {
    add() {
      // this.todoarrow=true;
      this.$store.commit("changelist", {
        type: "add",
        data: {
          content: this.value,
          id: new Date().getTime(),
          code: 0,
          check: false,
        },
      });
      this.value=''
    },
  },
  computed: {},
};
</script>

<style lang="scss" scoped>
.myinput {
  width: 100%;
  height: 50px;
  padding: 10px;
  display: flex;
  input {
    width: 80%;
    height: 100%;
    outline: 0;
    text-indent: 1em;
    border-radius: 6px;
    border: 1px solid gainsboro;
    font-size: 18px;
  }
  button {
    width: 20%;
    height: 100%;
    margin-left: 10px;
    border-radius: 6px;
    color: #fff;
    border: 0;
    font-size: 18px;
  }
}
</style>